<?php

namespace common\models;

use Yii;
use common\models\base\Material as base;

/**
 * This is the model class for table "material".
 *
 * @property integer $id
 * @property integer $type
 * @property string $description
 * @property string $filename
 * @property integer $is_deleted
 */
class Material extends base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'material';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['type', 'is_deleted'], 'integer'],
            [['description', 'filename'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'type' => 'Type',
            'description' => 'Description',
            'filename' => 'Filename',
            'is_deleted' => 'Is Deleted',
        ];
    }
	public function getArchive()
	{
		return $this->hasMany(\common\models\Archive::class,['id'=>'archive_id'])->viaTable('rel_archive_and_material',['material_id'=>'id']);
	}
}
